var app = getApp();

Page({
  data: {
    content: '',
    mobile: '',
    qq: ''
  },
  contentTap: function (e) {
    this.setData({
      content: e.detail.value
    })
  },
  mobileTap: function (e) {
    this.setData({
      mobile: e.detail.value
    })
  },
  qqTap: function (e) {
    this.setData({
      qq: e.detail.value
    })
  },
  sendtap: function (e) {
    var that = this;
    //判断是否输入问题描述
    if (that.data.content == '') {
      wx.showModal({
        title: '提示',
        content: '请输入问题描述!',
        showCancel: false,
        success: function (res) { }
      });
      return false;
    }

    //判断是否输入电话
    if (that.data.mobile == '') {
      wx.showModal({
        title: '提示',
        content: '请输入您的电话号码!',
        showCancel: false,
        success: function (res) { }
      });
      return false;
    }

    //判断是否输入QQ账号
    if (that.data.qq == '') {
      wx.showModal({
        title: '提示',
        content: '请输入您的QQ账号!',
        showCancel: false,
        success: function (res) { }
      });
      return false;
    }

    //反馈问题
    var jsonData = {
      content: that.data.content,
      mobile: that.data.mobile,
      qq: that.data.qq
    };
    app.showLoading("正在提交...请稍后...");
    app.JsonPost("Api/Consulting/add", jsonData, function (data) {
      app.closeLoading();
      if (data !== false) {
        wx.showModal({
          title: '提示',
          content: '提交成功!',
          showCancel: false,
          success: function (res) {
            that.setData({
              content: '',
              mobile: '',
              qq: ''
            })
          }
        });
      }
    })

  }
})